\[
\underbrace{\hat{y} = \beta_0 + \beta_1x_1}_\text{simple linear regression}\\
\]
Let’s say we’re predicting the effect of fundraising (\(x_i\): number of dollars raised) on standardized test scores (\(y_i\)). But lets say that we are measuring students from 5 different schools. Could each school have a different baseline (\(\beta_0\)) standardized test score?
Mixed Effect Models
\[
\hat{y} = \beta_{0[j]} + \beta_1x_1
\]
Option: fit a separate intercept for each school (\(\beta_{0[j]}\)).
But…what if we think each school might have a different effect (e.g. schools with less funding might benefit more from fundraising).
Mixed Effect Models
\[
\hat{y} = \beta_{0[j]} + \beta_{1[j]}x_1
\]
Option: fit a separate intercept (\(\beta_{0[j]}\)) and slope (\(\beta_{1[j]}\)) for each school.
Great! But now we have two problems:
we’re throwing away information, if school A’s slope is 0.01, then school B’s effect is probably not 10,000
we can’t generalize our findings to other schools, only the one’s measured
Mixed Effect Models
💡 let’s assume that the school effects \(\beta_{0[j]}\) and \(\beta_{1[j]}\) are effects that are drawn from a population distribution of effects
Call:
lm(formula = Reaction ~ Days, data = df_sleep)
Residuals:
Min 1Q Median 3Q Max
-110.646 -27.951 1.829 26.388 139.875
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 252.321 6.406 39.389 < 2e-16 ***
Days 10.328 1.210 8.537 5.48e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 47.43 on 181 degrees of freedom
Multiple R-squared: 0.2871, Adjusted R-squared: 0.2831
F-statistic: 72.88 on 1 and 181 DF, p-value: 5.484e-15
Fitting a MEM in R
random_int <-lmer(Reaction ~ Days + (1| Subject), df_sleep)summary(random_int)
Linear mixed model fit by REML ['lmerMod']
Formula: Reaction ~ Days + (1 | Subject)
Data: df_sleep
REML criterion at convergence: 1815.4
Scaled residuals:
Min 1Q Median 3Q Max
-3.2361 -0.5406 0.0143 0.5204 4.2699
Random effects:
Groups Name Variance Std.Dev.
Subject (Intercept) 1296 36.00
Residual 952 30.85
Number of obs: 183, groups: Subject, 20
Fixed effects:
Estimate Std. Error t value
(Intercept) 252.5777 9.1033 27.75
Days 10.4319 0.7963 13.10
Correlation of Fixed Effects:
(Intr)
Days -0.367
Fitting a MEM in R
random_int_slope <-lmer(Reaction ~ Days + (1+ Days | Subject), df_sleep)summary(random_int_slope)
Linear mixed model fit by REML ['lmerMod']
Formula: Reaction ~ Days + (1 + Days | Subject)
Data: df_sleep
REML criterion at convergence: 1771.4
Scaled residuals:
Min 1Q Median 3Q Max
-3.9707 -0.4703 0.0276 0.4594 5.2009
Random effects:
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 582.72 24.140
Days 35.03 5.919 0.07
Residual 649.36 25.483
Number of obs: 183, groups: Subject, 20
Fixed effects:
Estimate Std. Error t value
(Intercept) 252.543 6.433 39.257
Days 10.452 1.542 6.778
Correlation of Fixed Effects:
(Intr)
Days -0.137
Reporting MEM Results
the average effect \(\mu\) : the expected effect for the population
the standard deviation/variance \(\sigma\): how variable this effect is across units
\(h_0(t)\) is the hazard function for a person with all predictor values \(\mathbf{x}_i =0\)
\(e^{\beta \cdot \mathbf{x}_i}\) is the relative risk of a person with predictors \(\mathbf{x}_i\) compared to a person with predictors \(\mathbf{x}_i = 0\)
Cox Proportional Hazards
a 1-unit increase in \(x_{ij}\) corresponds to an change in \(h(t | \mathbf{x}_i)\) a factor of \(e^{\beta_j}\) (multiplicative)
figure from: An Introduction to Statistical Learning with Applications in R, 2nd Edition
where \(\alpha_j\) is the discrimination parameter for item \(j\) and \(x_j\) is a binary variable indicating a person \(i\)’s correctness on item \(j\).
The steeper the slope of the ICC, the more information an item gives us about someone’s ability, so the higher weight it gets in our score.
Item Characteristic Curve
Item Information Curve
IIC: the derivative of ICC. How much information an item gives about different latent trait values.
Test Information Curve
Test Information Curves
Test Information Curves
Test Information Curves
Test Information Curve
Applications of IRT
Survey Design: e.g. A Survey about externship success in Chapman’s Law School, a survey measuring Depression
Standardized Tests: e.g. the GRE/SAT/ACT
Lab Assessments: e.g. people’s ratings of their own memory
Applications of IRT
IRT in R
library(mirt)set.seed(540)d <-sim_irt_df(n_people =30, n_items =10)fit2PL <-mirt(data = d, model =1, # one dimensional latent traititemtype ="2PL", verbose =FALSE)summary(fit2PL)
plot(fit2PL, type ="infotrace", facet_items =FALSE)
plot(fit2PL, type ="info")
Sneek Peek: Why Bayesian IRT?
💡 if each item has 1-3 parameters (\(\alpha_j, \beta_j, c_j\)) , and each person has 1 parameter (\(\theta_i\)), what happens to the number of parameters as items and sample size increases?